package cool.webstudy.singletondynamicscheduler.controller.scheduler;

import cool.webstudy.singletondynamicscheduler.model.dto.scheduler.CreateSchedulerTaskDTO;
import cool.webstudy.singletondynamicscheduler.model.dto.scheduler.UpdateSchedulerTaskDTO;
import cool.webstudy.singletondynamicscheduler.service.ISchedulerTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author think
 * @date 2025/2/20 15:39
 * @description: 定时任务管理接口控制器
 */
@RestController
@RequestMapping("/scheduler-tak")
public class SchedulerTaskController {
    @Autowired
    private ISchedulerTaskService schedulerTaskService;
    @PostMapping("/create")
    public Object create(@RequestBody CreateSchedulerTaskDTO dto){
        return schedulerTaskService.createSchedulerTask(dto);
    }
    @PostMapping("/update")
    public Object update(@RequestBody UpdateSchedulerTaskDTO dto){
        return schedulerTaskService.updateSchedulerTask(dto);
    }
    @PostMapping("/delete")
    public Object delete(@RequestBody String unCode){
        return schedulerTaskService.deleteSchedulerTask(unCode);
    }
}
